﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<QuanLyNhaThuoc.Models.AdminModel>" %>


 <ul class="nav nav-pills nav-stacked" id="lstGroup">
<li class="header">Nhóm người dùng</li>                                
<% foreach (var item in Model.GroupList.ToList())
    { %>
<li><a href="#" id="<%: item.GroupID %>" class="aa"><i class="glyphicon glyphicon-user"></i><%: item.GroupName %></a></li>
<%} %>
</ul>

<script type="text/javascript">
    $(function () {
        $("a.aa").click(function (evt) {
            $("a.aa").parent().removeClass("active");
            $(this).parent().addClass("active");
            $("#groupID").val($(this).attr("id"));            
           
            $.ajax({
                url: "/Admin/LoadMenuOfGroup",
                type: 'POST',
                data: { id: $(this).attr("id") },
                success: function (response) {
                    $("ul#tvRole").replaceWith(response);
                },
                error: function (xhr) {
                    var n = noty({ layout: 'topCenter', text: response, type: 'error', timeout: 2000 });
                }
            });
        });
    });
</script>
